package com.zy.db.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

@Slf4j
@Aspect
@Component
@SuppressWarnings("all")
public class SqlLogAspect {

    @Before("execution(* org.springframework.jdbc.core.JdbcTemplate.*(..))")
    public void logSqlQuery(JoinPoint joinPoint) {
        String methodName = joinPoint.getSignature().getName();
        Object[] args = joinPoint.getArgs();
        log.info("Executing SQL query: {}. Parameters: {}", methodName, args);
    }
}
